package cn.com.djin.ssm.entity;

import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

/**
 * 
 * @author djin
 *   用户实体类
 */
@JsonIgnoreProperties(value = { "hibernateLazyInitializer", "handler" })
public class User extends BaseEntity{
    
	private static final long serialVersionUID = 1L;
	
	 //用户id
	 private Integer uid;  
	 //用户真实姓名
     private String uname;  
     //用户登录名
     private String userName;
     //密码
     private String pwd;   
     //年纪
     private Integer age;
     //电话
     private String phone;
     //用户邮箱
     private String email;  
     //性别
     private Integer sex; 
     //头像
     private String avater; 
     //爱好
     private String hobby;  
     //生日
 	 @JsonFormat(pattern="yyyy/MM/dd",timezone="GMT+8")
     private Date birthday; 
     //用户类型
     private UserType usertype;
     //退出时间
 	 @JsonFormat(pattern="yyyy/MM/dd HH:mm:ss",timezone="GMT+8")
     private Date exitDate;
   
     //格式化类型名称
     private String usertypename;
     
	public Integer getUid() {
		return uid;
	}
	public Integer getAge() {
		return age;
	}
	public void setAge(Integer age) {
		this.age = age;
	}
	public void setUid(Integer uid) {
		this.uid = uid;
	}
	public String getUname() {
		return uname;
	}
	public void setUname(String uname) {
		this.uname = uname;
	}
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public String getPwd() {
		return pwd;
	}
	public void setPwd(String pwd) {
		this.pwd = pwd;
	}
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public Integer getSex() {
		return sex;
	}
	public void setSex(Integer sex) {
		this.sex = sex;
	}
	public String getAvater() {
		return avater;
	}
	public void setAvater(String avater) {
		this.avater = avater;
	}
	public String getHobby() {
		return hobby;
	}
	public void setHobby(String hobby) {
		this.hobby = hobby;
	}
	public Date getBirthday() {
		return birthday;
	}
	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}
	
	public UserType getUsertype() {
		return usertype;
	}
	public void setUsertype(UserType usertype) {
		this.usertype = usertype;
	}
	
	public String getUsertypename() {
		if(this.usertype!=null){
			this.usertypename = this.usertype.getUtname();
		}else{
			this.usertypename = "";
		}
		return usertypename;
	}
	public void setUsertypename(String usertypename) {
		this.usertypename = usertypename;
	}
	public Date getExitDate() {
		return exitDate;
	}
	public void setExitDate(Date exitDate) {
		this.exitDate = exitDate;
	}
	@Override
	public String toString() {
		return "User [uid=" + uid + ", uname=" + uname + ", userName=" + userName + ", pwd=" + pwd + ", age=" + age
				+ ", phone=" + phone + ", email=" + email + ", sex=" + sex + ", avater=" + avater + ", hobby=" + hobby
				+ ", birthday=" + birthday + ", usertype=" + usertype + ", exitDate=" + exitDate + ", usertypename="
				+ usertypename + "]";
	}
	
}
